Skip to content

fix(#4718): stop running pre-code/pre-fix scripts twice per run#175

Open
waynesun09 wants to merge 1 commit into
mainfrom
fix-4718-dedupe-pre-scripts
Open

fix(#4718): stop running pre-code/pre-fix scripts twice per run#175
waynesun09 wants to merge 1 commit into
mainfrom
fix-4718-dedupe-pre-scripts

Conversation

@waynesun09

@waynesun09 waynesun09 commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

pre-code.sh and pre-fix.sh each run twice per agent invocation — once inline in fullsend-ai/fullsend's reusable workflow, once again as the harness pre_script inside fullsend run. This is the harness/scripts half of the fix (harness configs and pre/post scripts moved to this repo out of fullsend-ai/fullsend's internal/scaffold/fullsend-repo/).

Related Issue

Fixes fullsend-ai/fullsend#4718

Companion PR

fullsend-ai/fullsend#5013 — wires GH_TOKEN into the inline Validate inputs step (reusable-code.yml) and re-adds a lightweight inline step with FIX_SKIP_TOOL_INSTALL=true (reusable-fix.yml). This repo's changes have no effect without that companion PR, and vice versa — they were designed together.

Design

For code: the inline workflow step's skipped= output gates four downstream workflow steps (GCP setup, bot identity, agent env, the agent run itself) that all run before fullsend run is invoked — so the inline call can't simply be deleted. Instead, CODE_SKIP_EXISTING_PR_CHECK gates the expensive/side-effecting part (GH API search, pr-open label, issue comment) so it only runs once, on the inline call; the harness invocation skips straight to the tool-install section it's actually there for.

For fix: there's no output-gating dependency, but the inline call is still needed to fail fast on bad input/an exceeded iteration cap before GCP/agent-env setup runs. FIX_SKIP_TOOL_INSTALL lets the inline call skip only the pre-commit tool auto-install (which the harness invocation still needs, for the post-script's pre-commit run).

Changes

  • scripts/pre-code.sh — wrap the existing-human-PR check behind CODE_SKIP_EXISTING_PR_CHECK. Unset (default) preserves current behavior exactly.
  • harness/code.yaml — set CODE_SKIP_EXISTING_PR_CHECK: "true" in forge.github.runner_env, so only the harness pre_script invocation skips the already-performed check.
  • scripts/pre-fix.sh — wrap the pre-commit tool auto-install behind FIX_SKIP_TOOL_INSTALL.
  • scripts/pre-code-test.sh, scripts/pre-fix-test.sh — new files. Neither pre-script had test coverage in this repo; added coverage for existing behavior plus both new flags (26 + 12 cases).
  • Makefile — wire both new test files into script-test.

Testing

  • pre-commit run (staged changes) passes — yaml, shellcheck, secrets, etc.
  • make script-test passes for both new/modified files (38/38); one pre-existing, unrelated failure in post-scribe-test.sh confirmed present on unmodified main too.

Ported from the fullsend-ai/fullsend#4762 discussion — harness configs
and pre/post scripts live here now, so this is where the actual fix
belongs.

reusable-code.yml's inline "Validate inputs" step and pre-fix.sh's
equivalent both duplicate the harness pre_script that `fullsend run`
already executes right before sandbox creation. The inline call can't
just be deleted for code: its skipped= output gates four downstream
workflow steps (GCP setup, bot identity, agent env, the agent run
itself) that all run before `fullsend run` is invoked.

- scripts/pre-code.sh: gate the existing-human-PR search/label/comment
  behind a new CODE_SKIP_EXISTING_PR_CHECK env var. Unset (used by the
  inline workflow step) preserves today's behavior exactly.
- harness/code.yaml: set CODE_SKIP_EXISTING_PR_CHECK=true in
  forge.github.runner_env, so only the harness pre_script invocation
  skips the already-performed check.
- scripts/pre-fix.sh: gate the pre-commit tool auto-install behind a
  new FIX_SKIP_TOOL_INSTALL env var, set by reusable-fix.yml's inline
  step (fullsend-ai/fullsend side) so it can still fail fast on bad
  input/iteration cap without repeating the tool install.
- scripts/pre-code-test.sh, scripts/pre-fix-test.sh: new test files —
  neither pre-script had test coverage in this repo. Cover input
  validation, the existing behaviors, and both new flags.

Companion fix in fullsend-ai/fullsend wires GH_TOKEN into the inline
"Validate inputs" step (needed for the check to actually run there)
and re-adds reusable-fix.yml's inline step with FIX_SKIP_TOOL_INSTALL.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Jul 15, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:49 PM UTC · Completed 1:59 PM UTC
Commit: fcf3d04 · View workflow run →

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Deduplicate pre-code/pre-fix pre-scripts via skip flags + add coverage

🐞 Bug fix 🧪 Tests ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Prevent duplicate existing-PR side effects by gating pre-code checks behind an env flag.
• Allow fix validation to fail fast without repeating pre-commit tool auto-install.
• Add mock-based shell tests for both pre-scripts and wire into make script-test.
Diagram

graph TD
  WF["Reusable workflow: inline validate"] --> PRE1["scripts/pre-*.sh (inline)"]
  PRE1 -->|"code: run existing-PR check"| SE["Side effects + outputs"] --> RUN["fullsend run"]
  PRE1 -->|"FIX_SKIP_TOOL_INSTALL=true"| RUN
  RUN --> CFG["harness/* runner_env"] --> PRE2["scripts/pre-*.sh (pre_script)"] --> TOOLS["Tool auto-install"]
  PRE2 -->|"CODE_SKIP_EXISTING_PR_CHECK=true"| TOOLS
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Remove inline validate steps entirely
  • ➕ Eliminates the possibility of any double-execution by construction
  • ➕ Simplifies flag surface area
  • ➖ Breaks workflow-level gating that depends on inline outputs (e.g., skipped=)
  • ➖ Loses early failure before expensive runner/GCP setup
2. Make pre-scripts self-deduplicate via a shared marker file
  • ➕ No new env flags; idempotency enforced automatically
  • ➕ Works even if caller forgets to set flags
  • ➖ Requires shared filesystem state across invocations and careful scoping
  • ➖ Harder to reason about in ephemeral/parallel workflow contexts
3. Split scripts into explicit subcommands (validate vs side-effects vs tools)
  • ➕ Clearer contract: workflows call only the needed phase
  • ➕ Reduces conditional logic inside scripts
  • ➖ Larger refactor and coordination with companion repo/workflows
  • ➖ Higher migration risk for existing callers

Recommendation: Keep the current flag-gated approach: it preserves the required inline workflow gating behavior while preventing duplicate side effects/tool installs in the harness pre_script invocation. The alternatives either conflict with existing workflow dependencies, introduce brittle cross-step state, or require a much larger refactor best handled separately.

Files changed (6) +854 / -109

Bug fix (2) +141 / -109
pre-code.shGate existing-human-PR check behind CODE_SKIP_EXISTING_PR_CHECK +73/-55

Gate existing-human-PR check behind CODE_SKIP_EXISTING_PR_CHECK

• Wraps the GH_TOKEN/--force/open-PR search/label/comment and 'skipped=' output logic so it can be bypassed when invoked as a harness 'pre_script'. Default behavior remains unchanged when the flag is unset.

scripts/pre-code.sh

pre-fix.shAllow inline validation to skip pre-commit tool auto-install +68/-54

Allow inline validation to skip pre-commit tool auto-install

• Adds 'FIX_SKIP_TOOL_INSTALL' to bypass pre-commit tool auto-install when the script is run only for early validation in the workflow. The full harness 'pre_script' invocation still performs tool resolution/installation as before.

scripts/pre-fix.sh

Tests (3) +711 / -0
MakefileRun new pre-script tests in 'script-test' target +2/-0

Run new pre-script tests in 'script-test' target

• Adds 'scripts/pre-code-test.sh' and 'scripts/pre-fix-test.sh' to the 'script-test' suite so they run in CI/local test flows.

Makefile

pre-code-test.shAdd mock-gh tests for existing-PR behavior and skip flag +559/-0

Add mock-gh tests for existing-PR behavior and skip flag

• Introduces a comprehensive shell test harness that mocks 'gh' and verifies existing-human-PR detection, labeling/comment side effects, skipped= output behavior, and the new 'CODE_SKIP_EXISTING_PR_CHECK' bypass semantics.

scripts/pre-code-test.sh

pre-fix-test.shAdd tests for fix validation, iteration cap, and tool-skip flag +150/-0

Add tests for fix validation, iteration cap, and tool-skip flag

• Adds shell tests covering input validation, instruction length cap, iteration caps for human vs bot triggers, and 'FIX_SKIP_TOOL_INSTALL' behavior.

scripts/pre-fix-test.sh

Other (1) +2 / -0
code.yamlSet CODE_SKIP_EXISTING_PR_CHECK for harness pre_script invocation +2/-0

Set CODE_SKIP_EXISTING_PR_CHECK for harness pre_script invocation

• Configures 'forge.github.runner_env' to set 'CODE_SKIP_EXISTING_PR_CHECK: "true"', ensuring the harness-driven pre-code run skips the already-completed existing-PR check.

harness/code.yaml

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (2)

Context used
✅ Compliance rules (platform): 55 rules
✅ Skills: 4 invoked
  code-review
  code-implementation
  pr-review
  docs-review

Grey Divider


Action required

1. Unsanitized values in ::notice:: 📜 Skill insight ⛨ Security
Description
The PR emits GitHub Actions workflow commands (e.g., ::notice:: and ::warning::) that
interpolate variables (FIRST_PR_NUM, FIRST_PR_AUTHOR, RESOLVE_SCRIPT, INSTALL_SCRIPT)
without sanitizing them for :: sequences, encoded newlines, ANSI/control characters. This can
enable workflow-command injection if any of those values contain unsafe characters (for example from
unexpected CLI output).
Code

scripts/pre-code.sh[R103-109]

+  if [[ -n "${HUMAN_PR_LINES}" ]]; then
+    # Parse the first PR for the notice.
+    FIRST_PR_NUM="$(echo "${HUMAN_PR_LINES}" | head -1 | cut -f1)"
+    FIRST_PR_AUTHOR="$(echo "${HUMAN_PR_LINES}" | head -1 | cut -f2)"
+
+    echo "::notice::Found existing human PR #${FIRST_PR_NUM} by @${FIRST_PR_AUTHOR}"
+
Relevance

⭐⭐ Medium

Mixed history: sanitize in workflow commands accepted (PR #90) but similar request rejected (PR
#148).

PR-#90
PR-#148

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The compliance rule requires sanitizing every interpolated value used inside GitHub Actions workflow
commands. In scripts/pre-code.sh, the line `echo "::notice::Found existing human PR
#${FIRST_PR_NUM} by @${FIRST_PR_AUTHOR}" shows FIRST_PR_NUM and FIRST_PR_AUTHOR` being inserted
directly into a ::notice:: command without sanitization, and in scripts/pre-fix.sh the modified
warning output includes ::warning::Expected ${RESOLVE_SCRIPT} and ${INSTALL_SCRIPT} (and related
warnings) which likewise interpolate RESOLVE_SCRIPT and INSTALL_SCRIPT without any sanitization,
demonstrating the same injection risk across both scripts.

scripts/pre-code.sh[103-109]
scripts/pre-fix.sh[145-152]
Skill: pr-review

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`scripts/pre-code.sh` and `scripts/pre-fix.sh` emit GitHub Actions workflow commands (`::notice::` / `::warning::`) that interpolate variables (`FIRST_PR_NUM`, `FIRST_PR_AUTHOR`, `RESOLVE_SCRIPT`, `INSTALL_SCRIPT`) without sanitizing each value individually.

## Issue Context
GitHub Actions workflow commands are security-sensitive; any interpolated value must be sanitized to prevent workflow-command injection via `::`, `%0A/%0D` (encoded newlines), ANSI escape sequences, or other control characters. Ensure every variable inserted into workflow-command output is sanitized before being echoed.

## Fix Focus Areas
- scripts/pre-code.sh[103-109]
- scripts/pre-fix.sh[145-152]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Undeclared perl test dependency 🐞 Bug ☼ Reliability
Description
scripts/pre-code-test.sh requires perl to patch placeholders in the generated mock gh binary,
but the script-test workflow does not declare/install perl. This can make make script-test fail on
minimal/self-hosted runners (or if the base runner image changes) even though the code under test is
fine.
Code

scripts/pre-code-test.sh[R71-77]

+  # Patch placeholders with actual paths (avoid sed on source files,
+  # but this is a generated mock — not repo source code).
+  local escaped_log="${gh_log//\//\\/}"
+  local escaped_out="${TMPDIR//\//\\/}\/pr-list-output.txt"
+  perl -pi -e "s/LOGFILE_PLACEHOLDER/${escaped_log}/g" "${mock_bin}/gh"
+  perl -pi -e "s/OUTPUT_PLACEHOLDER/${escaped_out}/g" "${mock_bin}/gh"
+
Relevance

⭐⭐⭐ High

Team accepted adding missing CI tool deps to keep script-test reliable (PR #119, #80).

PR-#119
PR-#80

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new test script invokes perl -pi directly, and the CI workflow that runs make script-test
does not install perl as part of its dependency setup, creating an implicit test prerequisite.

scripts/pre-code-test.sh[71-77]
.github/workflows/script-test.yml[23-35]
PR-#119

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`scripts/pre-code-test.sh` currently uses `perl -pi` to patch placeholder strings in a generated mock `gh` script. This introduces an undeclared runtime dependency for `make script-test`, which can break on environments where Perl is not present.

### Issue Context
The repo’s CI job for script tests installs Python + some pip deps, but does not explicitly install Perl. While GitHub-hosted Ubuntu images typically include Perl today, this is an implicit dependency and reduces portability/reproducibility.

### Fix Focus Areas
- scripts/pre-code-test.sh[71-77]
- .github/workflows/script-test.yml[23-35]

### Suggested fixes (pick one)
1) **Avoid Perl**: generate the mock `gh` script with variable interpolation (or use a tool already required/installed, e.g. `python3 -c`), removing the `perl -pi` calls entirely.
2) **Declare dependency**: explicitly install perl in `.github/workflows/script-test.yml` (and document it as a prerequisite for local runs), so the test suite has deterministic dependencies.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Protected paths modified in PR 📜 Skill insight § Compliance
Description
This PR modifies protected governance/infrastructure paths (harness/ and scripts/), which must
receive human review and must not be auto-approved. Even though the PR links a justification (issue
#4718), a protected-path finding is still required.
Code

harness/code.yaml[R65-66]

+      # Skips the already-performed existing-PR check (fullsend-ai/fullsend#4718)
+      CODE_SKIP_EXISTING_PR_CHECK: "true"
Relevance

⭐⭐ Medium

Only prior “protected-path” review notes were undetermined (e.g., protected skills/ path in PR #59).

PR-#59

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist explicitly treats changes under harness/ and scripts/ as protected-path
modifications requiring a finding. The diff shows an edit to harness/code.yaml (and the PR also
changes multiple scripts/* files).

harness/code.yaml[65-66]
Skill: pr-review

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Protected governance/infrastructure paths were modified, which requires explicit human review and must not be auto-approved.

## Issue Context
Protected paths include `harness/` and `scripts/`.

## Fix Focus Areas
- harness/code.yaml[65-66]
- scripts/pre-code.sh[71-141]
- scripts/pre-fix.sh[116-181]
- scripts/pre-code-test.sh[1-559]
- scripts/pre-fix-test.sh[1-150]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread scripts/pre-code.sh
Comment on lines +103 to +109
if [[ -n "${HUMAN_PR_LINES}" ]]; then
# Parse the first PR for the notice.
FIRST_PR_NUM="$(echo "${HUMAN_PR_LINES}" | head -1 | cut -f1)"
FIRST_PR_AUTHOR="$(echo "${HUMAN_PR_LINES}" | head -1 | cut -f2)"

echo "::notice::Found existing human PR #${FIRST_PR_NUM} by @${FIRST_PR_AUTHOR}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Unsanitized values in ::notice:: 📜 Skill insight ⛨ Security

The PR emits GitHub Actions workflow commands (e.g., ::notice:: and ::warning::) that
interpolate variables (FIRST_PR_NUM, FIRST_PR_AUTHOR, RESOLVE_SCRIPT, INSTALL_SCRIPT)
without sanitizing them for :: sequences, encoded newlines, ANSI/control characters. This can
enable workflow-command injection if any of those values contain unsafe characters (for example from
unexpected CLI output).
Agent Prompt
## Issue description
`scripts/pre-code.sh` and `scripts/pre-fix.sh` emit GitHub Actions workflow commands (`::notice::` / `::warning::`) that interpolate variables (`FIRST_PR_NUM`, `FIRST_PR_AUTHOR`, `RESOLVE_SCRIPT`, `INSTALL_SCRIPT`) without sanitizing each value individually.

## Issue Context
GitHub Actions workflow commands are security-sensitive; any interpolated value must be sanitized to prevent workflow-command injection via `::`, `%0A/%0D` (encoded newlines), ANSI escape sequences, or other control characters. Ensure every variable inserted into workflow-command output is sanitized before being echoed.

## Fix Focus Areas
- scripts/pre-code.sh[103-109]
- scripts/pre-fix.sh[145-152]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread harness/code.yaml
Comment on lines +65 to +66
# Skips the already-performed existing-PR check (fullsend-ai/fullsend#4718)
CODE_SKIP_EXISTING_PR_CHECK: "true"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

2. Protected paths modified in pr 📜 Skill insight § Compliance

This PR modifies protected governance/infrastructure paths (harness/ and scripts/), which must
receive human review and must not be auto-approved. Even though the PR links a justification (issue
#4718), a protected-path finding is still required.
Agent Prompt
## Issue description
Protected governance/infrastructure paths were modified, which requires explicit human review and must not be auto-approved.

## Issue Context
Protected paths include `harness/` and `scripts/`.

## Fix Focus Areas
- harness/code.yaml[65-66]
- scripts/pre-code.sh[71-141]
- scripts/pre-fix.sh[116-181]
- scripts/pre-code-test.sh[1-559]
- scripts/pre-fix-test.sh[1-150]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread scripts/pre-code-test.sh
Comment on lines +71 to +77
# Patch placeholders with actual paths (avoid sed on source files,
# but this is a generated mock — not repo source code).
local escaped_log="${gh_log//\//\\/}"
local escaped_out="${TMPDIR//\//\\/}\/pr-list-output.txt"
perl -pi -e "s/LOGFILE_PLACEHOLDER/${escaped_log}/g" "${mock_bin}/gh"
perl -pi -e "s/OUTPUT_PLACEHOLDER/${escaped_out}/g" "${mock_bin}/gh"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

3. Undeclared perl test dependency 🐞 Bug ☼ Reliability

scripts/pre-code-test.sh requires perl to patch placeholders in the generated mock gh binary,
but the script-test workflow does not declare/install perl. This can make make script-test fail on
minimal/self-hosted runners (or if the base runner image changes) even though the code under test is
fine.
Agent Prompt
### Issue description
`scripts/pre-code-test.sh` currently uses `perl -pi` to patch placeholder strings in a generated mock `gh` script. This introduces an undeclared runtime dependency for `make script-test`, which can break on environments where Perl is not present.

### Issue Context
The repo’s CI job for script tests installs Python + some pip deps, but does not explicitly install Perl. While GitHub-hosted Ubuntu images typically include Perl today, this is an implicit dependency and reduces portability/reproducibility.

### Fix Focus Areas
- scripts/pre-code-test.sh[71-77]
- .github/workflows/script-test.yml[23-35]

### Suggested fixes (pick one)
1) **Avoid Perl**: generate the mock `gh` script with variable interpolation (or use a tool already required/installed, e.g. `python3 -c`), removing the `perl -pi` calls entirely.
2) **Declare dependency**: explicitly install perl in `.github/workflows/script-test.yml` (and document it as a prerequisite for local runs), so the test suite has deterministic dependencies.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@rh-hemartin rh-hemartin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's see what agents have to say.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Verdict: Approve

This PR correctly deduplicates pre-code.sh and pre-fix.sh invocations by introducing environment variable gates (CODE_SKIP_EXISTING_PR_CHECK and FIX_SKIP_TOOL_INSTALL) that let each script skip work already performed by the reusable workflow's inline step.

What was reviewed

Dimension Result
Correctness ✅ Clean — both flags use strict == "true" comparison with :-false defaults (fail-closed). The if/else wrapping preserves all existing behavior when flags are unset. GITHUB_OUTPUT contract is correctly maintained for the inline invocation path.
Security ✅ Clean — both flags are fail-closed. CODE_SKIP_EXISTING_PR_CHECK is set only in maintainer-controlled harness/code.yaml forge.github.runner_env, not reachable from user-supplied inputs. Even if bypassed, it only skips an idempotent duplicate check — input validation runs unconditionally. No new GHA workflow command interpolations introduced.
Intent & coherence ✅ Changes trace to fullsend-ai/fullsend#4718. The asymmetry between code.yaml (sets flag here) and fix.yaml (flag set in companion repo) is architecturally justified by different gating requirements.
Style & conventions ✅ Shell scripting style, test structure, and naming conventions are consistent with existing codebase patterns.
Docs currency ✅ New env vars are internal (set automatically, not user-configurable) and properly documented in script header comments. User-facing docs (docs/code.md, docs/fix.md) correctly remain unchanged.
Cross-repo contracts ✅ Backward compatible. Both :-false defaults ensure no behavior change when flags are unset. Exit code contracts preserved. Companion PR (fullsend-ai/fullsend#5013) is required for the fix to take effect.

Observations

  1. Case-sensitive flag comparison (scripts/pre-code.sh, scripts/pre-fix.sh): Both flags use exact string == "true" — values like "TRUE", "1", or "yes" will not activate the skip. The failure mode is safe (the check/install runs twice, the original behavior), but this could cause debugging confusion. Consider documenting this in the inline comments.

  2. Missing negative test for non-canonical truthy values (scripts/pre-code-test.sh): A test like CODE_SKIP_EXISTING_PR_CHECK=TRUE verifying it falls through to the normal check path would guard against future regressions that might loosen the comparison.

  3. Test coverage beyond strict issue scope (scripts/pre-code-test.sh, scripts/pre-fix-test.sh): The test files include comprehensive coverage for pre-existing behavior (force overrides, GITHUB_OUTPUT signals, iteration caps) beyond the new flags. This is justified as regression coverage for the refactored code paths (the entire check block was re-indented inside an if/else), but AGENTS.md §3 "Surgical changes" could be read more strictly. The transparency in the PR body about adding baseline coverage is appreciated.

  4. Env var placement (harness/code.yaml): CODE_SKIP_EXISTING_PR_CHECK is placed under forge.github.runner_env rather than the top-level runner_env. This is correct since it's only needed in the GitHub forge context, but differs from where CODE_ALLOWED_TARGET_BRANCHES is placed.


Protected paths detected — this PR modifies files under one or more
protected paths. The review agent cannot approve PRs that touch these paths.
A human reviewer must approve this PR.

Protected files in this PR:

  • harness/code.yaml
  • scripts/pre-code-test.sh
  • scripts/pre-code.sh
  • scripts/pre-fix-test.sh
  • scripts/pre-fix.sh

Labels: PR modifies pre-code/pre-fix scripts and code agent harness config

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the review comment for full details.

Comment thread scripts/pre-code.sh
echo "skipped=false" >> "${GITHUB_OUTPUT:-/dev/null}"
exit 0
fi
if [[ "${CODE_SKIP_EXISTING_PR_CHECK:-false}" == "true" ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low] edge-case

CODE_SKIP_EXISTING_PR_CHECK uses exact string comparison == "true" (lowercase only). Non-canonical truthy values ("TRUE", "1", "yes") will not activate the skip, causing the check to run a second time (the original double-run behavior). The failure mode is safe but could cause debugging confusion.

Suggested fix: Consider documenting in the inline comment that only the exact lowercase string "true" is accepted. Same applies to FIX_SKIP_TOOL_INSTALL in pre-fix.sh.

@fullsend-ai-review fullsend-ai-review Bot added requires-manual-review Review requires human judgment code-agent fix-agent bug Something isn't working labels Jul 15, 2026

@rh-hemartin rh-hemartin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed my mind, I do think we need to make this false by now, which is the current behavior. Then we set it to true in the workflows. This being true by default means that nothing happens on local executions, which we may want. I think having this as true would make scenario confusing.

waynesun09 added a commit to fullsend-ai/fullsend that referenced this pull request Jul 16, 2026
Records the pattern introduced in #5013/fullsend-ai/agents#175 so the
next agent that needs to gate expensive workflow setup behind a fast
pre-check (per rh-hemartin's request for consistency across agents,
one: an {AGENT}_SKIP_{THING} env var, set on whichever of the two
pre-script call sites should skip the redundant/expensive part.

Distinguishes this from ADR 0049's agent-configuration env vars —
same {AGENT}_{SETTING} syntax, but an internal invocation-context
signal rather than a user-facing behavioral knob, so it belongs in
script/harness comments, not docs/agents/<agent>.md.

Scopes the decision to agents that actually need workflow-level
gating (code, fix today) rather than mandating it retroactively for
agents that don't currently duplicate pre-script execution.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working code-agent fix-agent requires-manual-review Review requires human judgment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove redundant pre-code.sh / pre-fix.sh calls from reusable workflows

2 participants